package com.xhcl.web.controller.system;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.xhcl.common.annotation.Log;
import com.xhcl.common.constant.UserConstants;
import com.xhcl.common.core.controller.BaseController;
import com.xhcl.common.core.domain.AjaxResult;
import com.xhcl.common.core.domain.Stree;
import com.xhcl.common.enums.BusinessType;
import com.xhcl.framework.shiro.util.ShiroUtils;
import com.xhcl.system.domain.HsGjFsDw;
import com.xhcl.system.domain.SysRole;
import com.xhcl.system.domain.TGgYskm;
import com.xhcl.system.domain.YskmGjkmdm;
import com.xhcl.system.service.ITGgDwgjService;
import com.xhcl.system.service.ITGgFsdwService;
import com.xhcl.system.service.ITGgHsdwService;
import com.xhcl.system.service.ITGgKmdmService;
import com.xhcl.system.service.ITGgPtdwService;
import com.xhcl.system.service.ITGgPtdwgjService;
import com.xhcl.system.service.ITGgYskjkmgjService;
import com.xhcl.system.service.ITGgYskmService;

/**
 * 核算单位Controller
 * 
 * @author xhcl
 * @date 2020-08-26
 */
@Controller
@RequestMapping("/system/yskmgjkmdm")
public class YskmGjkmdmController extends BaseController
{
    private String prefix = "system/yskmgjkmdm";


    @Autowired
    private ITGgYskmService tGgYskmService;
    

    @Autowired
    private ITGgKmdmService tGgKmdmService;
     
   
    @Autowired
    private ITGgYskjkmgjService tGgYskjkmgjService;

    @RequiresPermissions("system:yskmgjkmdm:view")
    @GetMapping()
    public String yskmgjkmdm()
    {
        return prefix + "/yskmgjkmdm";
    }

    /**
     * 加载核算单位树列表
     */
    @GetMapping("/treeData")
    @ResponseBody
    public List<Stree> treeData()
    {   
        TGgYskm tGgYskm=new TGgYskm();
    	List<Stree> Strees = tGgYskmService.selectTGgYskmTree(tGgYskm);
        return Strees;
    }

    @GetMapping("/kmdmtreeData")
    @ResponseBody
    public List<Stree> fsdwtreeData(String kmdm)
    {
        List<Stree> Strees = tGgKmdmService.selectTGgKmdmTree(kmdm);
        return Strees;
    }
    
    @RequiresPermissions("system:yskmgjkmdm:save")
    @Log(title = "保存挂接", businessType = BusinessType.UPDATE)
    @PostMapping("/save")
    @ResponseBody
    public AjaxResult editSave(@Validated YskmGjkmdm yskmGjkmdm) 
    {
        return toAjax(tGgYskjkmgjService.updateYskmGjkmdm(yskmGjkmdm));
    }
}
